Optimal. Leaf size=142 \[ -\frac {(3 A-4 i B) \left (a^4+i a^4 \tan (c+d x)\right )}{d}+\frac {a^4 (7 A-8 i B) \log (\cos (c+d x))}{d}+8 a^4 x (B+i A)+\frac {a^4 A \log (\sin (c+d x))}{d}-\frac {(A-2 i B) \left (a^2+i a^2 \tan (c+d x)\right )^2}{2 d}+\frac {i a B (a+i a \tan (c+d x))^3}{3 d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.42, antiderivative size = 142, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 4, integrand size = 32, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {3594, 3589, 3475, 3531} \[ -\frac {(A-2 i B) \left (a^2+i a^2 \tan (c+d x)\right )^2}{2 d}-\frac {(3 A-4 i B) \left (a^4+i a^4 \tan (c+d x)\right )}{d}+\frac {a^4 (7 A-8 i B) \log (\cos (c+d x))}{d}+8 a^4 x (B+i A)+\frac {a^4 A \log (\sin (c+d x))}{d}+\frac {i a B (a+i a \tan (c+d x))^3}{3 d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3475
Rule 3531
Rule 3589
Rule 3594
Rubi steps
\begin {align*} \int \cot (c+d x) (a+i a \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx &=\frac {i a B (a+i a \tan (c+d x))^3}{3 d}+\frac {1}{3} \int \cot (c+d x) (a+i a \tan (c+d x))^3 (3 a A+3 a (i A+2 B) \tan (c+d x)) \, dx\\ &=\frac {i a B (a+i a \tan (c+d x))^3}{3 d}-\frac {(A-2 i B) \left (a^2+i a^2 \tan (c+d x)\right )^2}{2 d}+\frac {1}{6} \int \cot (c+d x) (a+i a \tan (c+d x))^2 \left (6 a^2 A+6 a^2 (3 i A+4 B) \tan (c+d x)\right ) \, dx\\ &=\frac {i a B (a+i a \tan (c+d x))^3}{3 d}-\frac {(A-2 i B) \left (a^2+i a^2 \tan (c+d x)\right )^2}{2 d}-\frac {(3 A-4 i B) \left (a^4+i a^4 \tan (c+d x)\right )}{d}+\frac {1}{6} \int \cot (c+d x) (a+i a \tan (c+d x)) \left (6 a^3 A+6 a^3 (7 i A+8 B) \tan (c+d x)\right ) \, dx\\ &=\frac {i a B (a+i a \tan (c+d x))^3}{3 d}-\frac {(A-2 i B) \left (a^2+i a^2 \tan (c+d x)\right )^2}{2 d}-\frac {(3 A-4 i B) \left (a^4+i a^4 \tan (c+d x)\right )}{d}+\frac {1}{6} \int \cot (c+d x) \left (6 a^4 A+48 a^4 (i A+B) \tan (c+d x)\right ) \, dx-\left (a^4 (7 A-8 i B)\right ) \int \tan (c+d x) \, dx\\ &=8 a^4 (i A+B) x+\frac {a^4 (7 A-8 i B) \log (\cos (c+d x))}{d}+\frac {i a B (a+i a \tan (c+d x))^3}{3 d}-\frac {(A-2 i B) \left (a^2+i a^2 \tan (c+d x)\right )^2}{2 d}-\frac {(3 A-4 i B) \left (a^4+i a^4 \tan (c+d x)\right )}{d}+\left (a^4 A\right ) \int \cot (c+d x) \, dx\\ &=8 a^4 (i A+B) x+\frac {a^4 (7 A-8 i B) \log (\cos (c+d x))}{d}+\frac {a^4 A \log (\sin (c+d x))}{d}+\frac {i a B (a+i a \tan (c+d x))^3}{3 d}-\frac {(A-2 i B) \left (a^2+i a^2 \tan (c+d x)\right )^2}{2 d}-\frac {(3 A-4 i B) \left (a^4+i a^4 \tan (c+d x)\right )}{d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] time = 7.91, size = 429, normalized size = 3.02 \[ \frac {a^4 \sec (c) \sec ^3(c+d x) (\cos (4 d x)+i \sin (4 d x)) \left (3 \cos (d x) \left (3 (7 A-8 i B) \log \left (\cos ^2(c+d x)\right )+3 A \log \left (\sin ^2(c+d x)\right )+48 i A d x+4 A+48 B d x-16 i B\right )+3 \cos (2 c+d x) \left (3 (7 A-8 i B) \log \left (\cos ^2(c+d x)\right )+3 A \log \left (\sin ^2(c+d x)\right )+48 i A d x+4 A+48 B d x-16 i B\right )+48 i A \sin (2 c+d x)-48 i A \sin (2 c+3 d x)+48 i A d x \cos (2 c+3 d x)+48 i A d x \cos (4 c+3 d x)+21 A \cos (2 c+3 d x) \log \left (\cos ^2(c+d x)\right )+21 A \cos (4 c+3 d x) \log \left (\cos ^2(c+d x)\right )+3 A \cos (2 c+3 d x) \log \left (\sin ^2(c+d x)\right )+3 A \cos (4 c+3 d x) \log \left (\sin ^2(c+d x)\right )-96 i A \sin (d x)+96 B \sin (2 c+d x)-88 B \sin (2 c+3 d x)+48 B d x \cos (2 c+3 d x)+48 B d x \cos (4 c+3 d x)-24 i B \cos (2 c+3 d x) \log \left (\cos ^2(c+d x)\right )-24 i B \cos (4 c+3 d x) \log \left (\cos ^2(c+d x)\right )-168 B \sin (d x)\right )}{48 d (\cos (d x)+i \sin (d x))^4} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [B] time = 1.04, size = 246, normalized size = 1.73 \[ \frac {6 \, {\left (5 \, A - 12 i \, B\right )} a^{4} e^{\left (4 i \, d x + 4 i \, c\right )} + 54 \, {\left (A - 2 i \, B\right )} a^{4} e^{\left (2 i \, d x + 2 i \, c\right )} + 4 \, {\left (6 \, A - 11 i \, B\right )} a^{4} + 3 \, {\left ({\left (7 \, A - 8 i \, B\right )} a^{4} e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, {\left (7 \, A - 8 i \, B\right )} a^{4} e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, {\left (7 \, A - 8 i \, B\right )} a^{4} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (7 \, A - 8 i \, B\right )} a^{4}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 3 \, {\left (A a^{4} e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, A a^{4} e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, A a^{4} e^{\left (2 i \, d x + 2 i \, c\right )} + A a^{4}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right )}{3 \, {\left (d e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 2.14, size = 333, normalized size = 2.35 \[ \frac {6 \, A a^{4} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right ) + 6 \, {\left (7 \, A a^{4} - 8 i \, B a^{4}\right )} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1\right ) - 12 \, {\left (8 \, A a^{4} - 8 i \, B a^{4}\right )} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + i\right ) + 6 \, {\left (7 \, A a^{4} - 8 i \, B a^{4}\right )} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1\right ) - \frac {77 \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{6} - 88 i \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{6} - 48 i \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 84 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 243 \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} + 312 i \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} + 96 i \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 184 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 243 \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 312 i \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 48 i \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 84 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 77 \, A a^{4} + 88 i \, B a^{4}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{3}}}{6 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.47, size = 169, normalized size = 1.19 \[ \frac {a^{4} A \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {7 A \,a^{4} \ln \left (\cos \left (d x +c \right )\right )}{d}+\frac {a^{4} B \left (\tan ^{3}\left (d x +c \right )\right )}{3 d}-\frac {7 a^{4} B \tan \left (d x +c \right )}{d}+8 a^{4} B x +\frac {8 a^{4} B c}{d}-\frac {8 i B \,a^{4} \ln \left (\cos \left (d x +c \right )\right )}{d}-\frac {2 i a^{4} B \left (\tan ^{2}\left (d x +c \right )\right )}{d}+8 i A x \,a^{4}+\frac {8 i A \,a^{4} c}{d}-\frac {4 i a^{4} A \tan \left (d x +c \right )}{d}+\frac {a^{4} A \ln \left (\sin \left (d x +c \right )\right )}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.79, size = 106, normalized size = 0.75 \[ \frac {2 \, B a^{4} \tan \left (d x + c\right )^{3} + 3 \, {\left (A - 4 i \, B\right )} a^{4} \tan \left (d x + c\right )^{2} + 6 \, {\left (d x + c\right )} {\left (8 i \, A + 8 \, B\right )} a^{4} - 24 \, {\left (A - i \, B\right )} a^{4} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 6 \, A a^{4} \log \left (\tan \left (d x + c\right )\right ) + {\left (-24 i \, A - 42 \, B\right )} a^{4} \tan \left (d x + c\right )}{6 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 6.22, size = 133, normalized size = 0.94 \[ \frac {A\,a^4\,\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )}{d}-\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (a^4\,\left (A-B\,1{}\mathrm {i}\right )\,3{}\mathrm {i}+B\,a^4+a^4\,\left (3\,B+A\,1{}\mathrm {i}\right )\right )}{d}-\frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {B\,a^4\,1{}\mathrm {i}}{2}+\frac {a^4\,\left (3\,B+A\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{2}\right )}{d}-\frac {8\,a^4\,\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (A-B\,1{}\mathrm {i}\right )}{d}+\frac {B\,a^4\,{\mathrm {tan}\left (c+d\,x\right )}^3}{3\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [B] time = 3.76, size = 289, normalized size = 2.04 \[ \frac {A a^{4} \log {\left (\frac {- 3 A a^{4} + 4 i B a^{4}}{3 A a^{4} e^{2 i c} - 4 i B a^{4} e^{2 i c}} + e^{2 i d x} \right )}}{d} + \frac {a^{4} \left (7 A - 8 i B\right ) \log {\left (e^{2 i d x} + \frac {- 4 A a^{4} + 4 i B a^{4} + a^{4} \left (7 A - 8 i B\right )}{3 A a^{4} e^{2 i c} - 4 i B a^{4} e^{2 i c}} \right )}}{d} + \frac {24 A a^{4} - 44 i B a^{4} + \left (54 A a^{4} e^{2 i c} - 108 i B a^{4} e^{2 i c}\right ) e^{2 i d x} + \left (30 A a^{4} e^{4 i c} - 72 i B a^{4} e^{4 i c}\right ) e^{4 i d x}}{3 d e^{6 i c} e^{6 i d x} + 9 d e^{4 i c} e^{4 i d x} + 9 d e^{2 i c} e^{2 i d x} + 3 d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________